<template>
  <view>
    <u-navbar :title="type.title + '管理'" back-icon-size="34" title-size="36" :border-bottom="false" :background="background" title-color="#222" back-icon-color="#222"></u-navbar>
    <image :src="img_url + type.banner" mode="widthFix" style="width: 100%"></image>
    <view class="" style="font-size: 30rpx; font-weight: bold; padding: 27rpx; border-bottom: 1rpx solid #e7e7e7; margin: 0 28rpx">{{ type.title }}方案</view>
    <view class="">
      <view class="" style="text-align: center; padding-top: 128rpx" v-if="data == ''">
        <image :src="img_url + type.image" mode="" style="width: 80rpx; height: 80rpx"></image>
        <view class="" style="font-size: 32rpx; padding-top: 10rpx">您暂未有{{ type.title }}方案</view>
        <view class="" style="font-size: 28rpx; color: #999999; padding-top: 12rpx">要养成良好的{{ type.title }}习惯</view>
      </view>
      <view class="" style="margin: 30rpx 28rpx; box-shadow: 0px 0px 12rpx 0px rgba(0, 0, 0, 0.08); border-radius: 20rpx" v-else v-for="(i, k) in data" :key="k">
        <view class="" style="padding: 33rpx 25rpx; display: flex; align-items: center; justify-content: space-between; font-size: 26rpx; border-bottom: 1rpx solid #e7e7e7">
          <view class="">{{ type.title }}方案名称</view>
          <view class="" style="color: #999999">
            {{ i.create_time_text }}
          </view>
        </view>
        <view class="" style="padding: 28rpx; font-size: 28rpx">
          {{ i.content }}
        </view>
        <view class="" style="font-size: 28rpx; text-align: right; padding-bottom: 29rpx; padding-right: 27rpx">医师：{{ i.doctor_name }}</view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      background: {
        background: '#FFFFFF'
      },
      type: {},
      patient_id: null,
      page: 1,
      data: []
    };
  },
  methods: {
    detail() {
      this.api({
        url: '/api/healthy/getPlanList',
        method: 'post',
        data: {
          page: this.page,
          patient_id: this.patient_id,
          type_id: this.type.type_id
        }
      }).then((res) => {
        this.data = this.data.concat(res.data);
        this.page++;
      });
    }
  },
  onLoad(op) {
    this.type = JSON.parse(op.type_id);
    this.patient_id = op.patient_id;
    this.detail();
  }
};
</script>

<style></style>
